//
// Created by rebeater on 11/5/21.
//

#ifndef ROBOTCONROL__ROBOTINFO_H_
#define ROBOTCONROL__ROBOTINFO_H_

#include <QWidget>
#include <thread>
#include <queue>
#include <mutex>
#include "robotmessage.h"
#include "SerialThread.h"
QT_BEGIN_NAMESPACE
namespace Ui { class RobotInfo; }
QT_END_NAMESPACE

class RobotInfo : public QWidget {
 Q_OBJECT

 public:
  explicit RobotInfo(QWidget *parent = nullptr);
  ~RobotInfo() override;

 private:
  Ui::RobotInfo *ui;
  void InitialUi();
  void SetSystemStatus(RobotMessage &msg);
  void SetVelocity(RobotMessage &msg);
  void SetDriverStatus(RobotMessage &msg);
  void SetOdometer(RobotMessage &msg);
  std::vector<std::string> ListDir(const std::string &path);

  /*user code*/
  std::vector<std::string> dev_list_;
  SerialThread *serial_thread_;

 public slots:
  void on_cbxTargetPort_clicked();
  void on_btnConnect_clicked();
  void on_txDeviceListUpdate_clicked();
   void on_messageQueueUpdated(RobotMessage s);
   void on_serialportStatusChanged(bool s);
};

#endif //ROBOTCONROL__ROBOTINFO_H_
